from ui.pyeditor import PluginEditorWidget
from core import cmds

class PluginEditor(ni.View):
    
    widget = PluginEditorWidget
    
    def update_widget(self, widget):
        pass
        
    def current_changed(self, obj):
        plugin = None
        print 'curr change', obj
        if cmds.is_plugin(obj):
            plugin = obj
        elif cmds.is_component(obj) or cmds.is_type(obj):
            plugin = obj.plugin
        
        if plugin is not None:
            for widget in self.widgets:
                widget.set_plugin(plugin)